Skip to content

Fix/title script shell injection - #1681

Open
asimawdah wants to merge 2 commits into
google-antigravity:mainfrom
asimawdah:fix/title-script-shell-injection
Open

asimawdah wants to merge 2 commits into
google-antigravity:mainfrom
asimawdah:fix/title-script-shell-injection

Conversation

@asimawdah

Copy link
Copy Markdown

Why

The examples/title/title.sh script used eval to assign values extracted from JSON input. This could allow shell command execution if fields such as workspace.current_dir or agent_state contained shell expressions like $(...).

Removing eval makes JSON-derived values remain plain data instead of executable shell code.

What changed

  • Removed unsafe eval usage from title.sh.
  • Replaced dynamic shell evaluation with direct jq extraction.
  • Preserved the existing title formatting and fallback behavior.
  • Added test_title.sh with regression tests covering:
    • Normal workspace title formatting.
    • Command substitution in workspace.current_dir.
    • Command substitution in agent_state.
    • Invalid JSON input and fallback behavior.

Testing

Run the regression tests with:

bash examples/title/test_title.sh

The test script requires jq.

Check shell syntax with:

bash -n examples/title/title.sh examples/title/test_title.sh

Versioning

  • Breaking protocol change
  • Breaking TS/JS API change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant